//
//  HyphenateViewController.m
//  JSTest
//
//  Created by 奇林刘 on 2018/9/27.
//  Copyright © 2018年 奇林刘. All rights reserved.
//

#import "HyphenateViewController.h"

@interface HyphenateViewController ()

@end

@implementation HyphenateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[EMClient sharedClient] loginWithUsername:[AccountIOSEngineer lowercaseString] password:PasswordIOSEngineer completion:^(NSString *aUsername, EMError *aError) {
        if (!aError) {
            NSLog(@"Login Success : %@", aUsername);
            [self makeGoChatButton];
        } else {
            NSLog(@"WARNING Login Error : %@", aError.errorDescription);
        }
    }];
}

- (void)makeGoChatButton {
    UIButton *goChatButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 50, 300, 300)];
    [self.view addSubview:goChatButton];
    
    [goChatButton setTitle:@"goChat" forState:UIControlStateNormal];
    [goChatButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [goChatButton addTarget:self action:@selector(goChatButtonClick) forControlEvents:UIControlEventTouchUpInside];
}

- (void)goChatButtonClick {
    EaseMessageViewController *chatController = [[EaseMessageViewController alloc] initWithConversationChatter:AccountLumaBoss conversationType:EMConversationTypeChat];
    chatController.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:chatController animated:YES];
}


@end
